import { OnInit, Component, ViewChild } from '@angular/core';
import { ClassListComponent } from './class-list.component';

@Component({
  selector: 'app-class-view',
  templateUrl: './class-view.component.html',
  styles: [],
})
export class ClassViewComponent implements OnInit {
  constructor() {}

  @ViewChild('classListComponent', { static: false })
  classListComponent: ClassListComponent;

  /**
   * 条件查询参数
   */
  queryParams = {
    code: null,
    name: null,
    grade: '',
    academyId: null,
    professionId: null,
  };

  /**
   * 添加班级
   */
  create() {
    this.classListComponent.create();
  }

  /**
   * 刷新
   */
  reflesh() {
    this.classListComponent.loadData();
  }

  /**
   * 查询
   */
  onSearch() {
    this.classListComponent.loadData();
  }

  /**
   * 重置表单
   */
  onResetForm() {
    this.queryParams.professionId = null;
    this.queryParams.academyId = null;
    this.queryParams.grade = '';
    this.queryParams.code = null;
    this.queryParams.name = null;
  }

  ngOnInit() {}
}
